package com.tt.setting;

import com.tt.AgeGroup;
import com.tt.CoreType;

/**
 * Created by castiel on 2017/12/29.
 */

public class RecordSetting {

    private static final String TAG = "17kouyu";

    //soundIntensityEnable 音强值开关，默认0不返回音强值，可选1
    private boolean isNeedSoundIntensity;//可选，是否需要返回音强值
    //audio
    private String audioType = "wav";//必选，音频格式
    private int sampleRate = 16000;//必选，采样率
    private int channel = 1;//必选，声道数，1位单声道
    //request
    private String coreType;//必选，请求的内核类型
    private String refText;//必选，参考文本，使用非音频比对内核时必须，多个参考答案用|隔开
    private String refAudio;//标准音频文件的绝对/相对路径，使用音频比对内核时必选
    private boolean isNeedRequestParamsInResult;//可选，是否需要在返回结果中同时返回请求参数，在线版有效
    private boolean isNeedWordScoreInParagraph;//可选，是否需要在段落评测结果中显示每个单词的具体得分
    private boolean isNeedAttachAudioUrlInResult = true;//可选，使用云服务时可选，是否需要在返回结果中附带音频下载地址，在线版有效
    private String dict_type = "KK";//可选，音素字典选项，默认"KK"，可选CMU/KK/IPA88
    private boolean isNeedPhonemeOutputInWord = true;//可选，是否需要在单词评测结果中显示音素信息
    private int scale = 100;//可选，评分制，取值范围(0,100]
    private double precision = 1;//可选，评分精度，取值范围(0,1]
    private double slack;//可选，人工干预得分，取值范围[-1,1]，正数加分负数减分，一般为0.2为轻度调整，1为最强度调整
    private String keywords;//可选，关键词，open.eval题型有效，多个关键词之间用|隔开
    private int qType;//可选，题型，open.eval题型必须，0：短文朗读；1：短文跟读；2：句子翻译；3：段落翻译；4：故事复述；5：看图说话；6：情景问答；7：口头作文
    private int agegroup = AgeGroup.AGEGROUP3;//

    @Override
    public String toString() {
        return "RecordSetting{" +
                "isNeedSoundIntensity=" + isNeedSoundIntensity +
                ", audioType='" + audioType + '\'' +
                ", sampleRate=" + sampleRate +
                ", channel=" + channel +
                ", coreType='" + coreType + '\'' +
                ", refText='" + refText + '\'' +
                ", refAudio='" + refAudio + '\'' +
                ", isNeedRequestParamsInResult=" + isNeedRequestParamsInResult +
                ", isNeedWordScoreInParagraph=" + isNeedWordScoreInParagraph +
                ", isNeedAttachAudioUrlInResult=" + isNeedAttachAudioUrlInResult +
                ", dict_type='" + dict_type + '\'' +
                ", isNeedPhonemeOutputInWord=" + isNeedPhonemeOutputInWord +
                ", scale=" + scale +
                ", precision=" + precision +
                ", slack=" + slack +
                ", keywords='" + keywords + '\'' +
                ", qType=" + qType +
                '}';
    }

    //非音频比对、非开放题型构造器
    public RecordSetting(String coreType, String refText){
        this.coreType = coreType;
        this.refText = refText;
    }

    //开放题型构造器
    public RecordSetting(String refText, int qType){
        this.coreType = CoreType.EN_OPEN_EVAL;
        this.refText = refText;
        this.qType = qType;
    }

    //音频比对题型构造器
    public RecordSetting(String refAudio){
        this.coreType = CoreType.EN_ALIGN_EVAL;
        this.refAudio = refAudio;
    }

    public boolean isNeedSoundIntensity() {
        return isNeedSoundIntensity;
    }

    //设置是否需要返回音强值，true：需要；false：不需要
    public RecordSetting setNeedSoundIntensity(boolean needSoundIntensity) {
        isNeedSoundIntensity = needSoundIntensity;
        return this;
    }

    public String getAudioType() {
        return audioType;
    }

    public RecordSetting setAudioType(String audioType) {
        this.audioType = audioType;
        return this;
    }

    public int getSampleRate() {
        return sampleRate;
    }

    public RecordSetting setSampleRate(int sampleRate) {
        this.sampleRate = sampleRate;
        return this;
    }

    public int getChannel() {
        return channel;
    }

    public RecordSetting setChannel(int channel) {
        this.channel = channel;
        return this;
    }

    public boolean isNeedRequestParamsInResult() {
        return isNeedRequestParamsInResult;
    }

    //设置是否需要在返回结果中同时返回请求参数，true：需要；false：不需要
    public RecordSetting setNeedRequestParamsInResult(boolean needRequestParamsInResult) {
        isNeedRequestParamsInResult = needRequestParamsInResult;
        return this;
    }

    public String getCoreType() {
        return coreType;
    }

//    public void setCoreType(String coreType) {
//        this.coreType = coreType;
//    }

    public String getRefText() {
        return refText;
    }

//    public void setRefText(String refText) {
//        this.refText = refText;
//    }

    public String getRefAudio() {
        return refAudio;
    }

//    public void setRefAudio(String refAudio) {
//        this.refAudio = refAudio;
//    }

    public boolean isNeedWordScoreInParagraph() {
        return isNeedWordScoreInParagraph;
    }

    //设置是否需要在段落评测结果中显示每个单词的具体得分，true：需要；false：不需要
    public RecordSetting setNeedWordScoreInParagraph(boolean needWordScoreInParagraph) {
        isNeedWordScoreInParagraph = needWordScoreInParagraph;
        return this;
    }

    public boolean isNeedAttachAudioUrlInResult() {
        return isNeedAttachAudioUrlInResult;
    }

    //使用云服务时可选，是否需要在返回结果中附带音频下载地址
    public RecordSetting setNeedAttachAudioUrlInResult(boolean needAttachAudioUrlInResult) {
        isNeedAttachAudioUrlInResult = needAttachAudioUrlInResult;
        return this;
    }

    public String getDict_type() {
        return dict_type;
    }

    //设置音素字典，默认"KK"，可选CMU/KK/IPA88
    public RecordSetting setDict_type(String dict_type) {
        this.dict_type = dict_type;
        return this;
    }

    public boolean isNeedPhonemeOutputInWord() {
        return isNeedPhonemeOutputInWord;
    }

    //是否需要在单词评测结果中显示音素信息
    public RecordSetting setNeedPhonemeOutputInWord(boolean needPhonemeOutputInWord) {
        isNeedPhonemeOutputInWord = needPhonemeOutputInWord;
        return this;
    }

    public int getScale() {
        return scale;
    }

    //评分制，取值范围(0,100]
    public RecordSetting setScale(int scale) {
        this.scale = scale;
        return this;
    }

    public double getPrecision() {
        return precision;
    }

    //评分精度，取值范围(0,1]
    public RecordSetting setPrecision(double precision) {
        this.precision = precision;
        return this;
    }

    public double getSlack() {
        return slack;
    }

    //人工干预得分，取值范围[-1,1]，正数加分负数减分，一般为0.2为轻度调整，1为最强度调整
    public RecordSetting setSlack(double slack) {
        this.slack = slack;
        return this;
    }

    public String getKeywords() {
        return keywords;
    }

    //关键词，open.eval题型有效，多个关键词之间用|隔开
    public RecordSetting setKeywords(String keywords) {
        this.keywords = keywords;
        return this;
    }

    public int getqType() {
        return qType;
    }

//    public void setqType(int qType) {
//        this.qType = qType;
//    }

    public int getAgegroup() {
        return agegroup;
    }

    public void setAgegroup(int agegroup) {
        this.agegroup = agegroup;
    }
}
